<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>性能对比报告</title>
    <style>
        body { font-family: Arial, sans-serif; }
        table { border-collapse: collapse; width: 100%; }
        th, td { border: 1px solid #ccc; padding: 8px; text-align: left; }
        th { background: #f0f0f0; }
    </style>
</head>
<body>
    <h1>性能对比报告</h1>
    <p>生成时间：{{ report_time }}</p>
    <h2>对比结果</h2>
    <table>
        <tr>
            <th>类型</th>
            <th>名称</th>
            <th>值A/失败:运行A</th>
            <th>变化</th>
            <th>值B/失败:运行B</th>
        </tr>
        {% for item in results %}
        <tr>
            <td>{{ item.type }}</td>
            <td>{{ item.name }}</td>
            <td>{{ item.value_a if item.type == 'metric' else item.fails_runs_a }}</td>
            <td>{{ item.change if item.type == 'metric' else '' }}</td>
            <td>{{ item.value_b if item.type == 'metric' else item.fails_runs_b }}</td>
        </tr>
        {% endfor %}
    </table>
    <p>总指标数：{{ total_metrics }}</p>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>性能对比报告</title>
    <style>
        body { font-family: Arial, sans-serif; margin: 20px; }
        .header { margin-bottom: 20px; }
        .metric { margin: 10px 0; padding: 10px; border: 1px solid #ddd; }
        .improvement { color: green; }
        .regression { color: red; }
    </style>
</head>
<body>
    <div class="header">
        <h1>性能对比报告</h1>
        <p>生成时间: {{ report_time }}</p>
        <p>总指标数: {{ total_metrics }}</p>
    </div>

    <div class="results">
        {% for result in results %}
            <div class="metric">
                {% if result.type == "metric" %}
                    <h3>{{ result.name }}</h3>
                    <p>基准值: {{ result.value_a }}</p>
                    <p>对比值: {{ result.value_b }}</p>
                    <p class="{{ 'improvement' if '-' in result.change else 'regression' }}">
                        变化: {{ result.change }}
                    </p>
                {% elif result.type == "error" %}
                    <h3>错误: {{ result.name }}</h3>
                    <p>基准组失败/运行: {{ result.fails_runs_a }}</p>
                    <p>对比组失败/运行: {{ result.fails_runs_b }}</p>
                {% endif %}
            </div>
        {% endfor %}
    </div>
</body>
</html>
